{include file="index/head" /}
<div class="box">
  <form method="post" action="{:url('add')}" class="sycmsform">
    <div class="box-head">
      <h2>广告管理</h2>
      <div class="fr">
        <button type="submit" class="btn"><i class="icon-check"></i>{$v.id?'编辑':'添加'}</button>
        &nbsp;<a href="javascript:history.go(-1);" class="btn fr"><i class="icon-mail-reply (alias)"></i>返回</a></div>
    </div>
    <div class="form">
    <input type="hidden" name="id" value="{$v.id}" />
    <input type="hidden" name="nid" value="{$nid}" />
    <input type="hidden" name="mid" value="{$mid}" />
    <ul class="tabcon" style="display:block;">
      <li>
        <label>标题：</label>
        <div class="item">
          <input type="text" name="title" value="{$v.title}" class="input w60" datatype="*" nullmsg="请输入标题"/>
        </div>
      </li>
      <li>
        <label>副标题：</label>
        <div class="item">
          <input type="text" class="input" name="subtitle" value="{$v.subtitle}" />
        </div>
      </li>      
      <li>
        <label>{if condition="$v.cid eq 76"}QQ：{else/}连接地址:{/if}</label>
        <div class="item">
          <input type="text" class="input" name="url" value="{$v.url}" />
        </div>
      </li>
      {if condition="$iscid eq 1"}
      <li>
        <label>所属分类：</label>
        <div class="item">
          <div class="select"><i class="icon-caret-down"></i>
            <input type="hidden" name="cid" value="{$v.cid}" class="inputval" />
            <input type="text" readonly placeholder="请选择分类" value="" class="input" />
            <dl class="select-value syui-anim syui-anim-up">
              {volist name="list" id="vo"}                         
              <dd data="{$vo.id}" {if condition="$vo.id eq $v.cid"}class=selected{/if}>{$vo.title}</dd>                           
              {volist name="vo['son']" id="vs"}
              <dd data="{$vs.id}" {if condition="$vs.id eq $v.cid"}class=selected{/if}>|--{$vs.title}</dd>
              {volist name="vs['son']" id="vc"}
              <dd data="{$vc.id}" {if condition="$vc.id eq $v.cid"}class=selected{/if}>|----{$vc.title}</dd>              
              {/volist}              
              {/volist}
              {/volist}
            </dl>
          </div>
        </div>
      </li>      
      <li>
        <label>属性：</label>
        <div class="item radio">
          <span><input type="checkbox" onclick="_checkbox('ishome')" {if condition="$v.ishome eq 1"} checked="checked" {/if} /> 首页</span>
          <span><input type="checkbox" onclick="_checkbox('isvouch')" {if condition="$v.isvouch eq 1"} checked="checked" {/if}/> 推荐</span>
          <span><input type="checkbox" onclick="_checkbox('istop')" {if condition="$v.istop eq 1"} checked="checked" {/if}/> 置顶</span>
          <input type="hidden" name="ishome" value="{$v.ishome|default=0}"  />
          <input type="hidden" name="isvouch" value="{$v.isvouch|default=0}" />
          <input type="hidden" name="istop" value="{$v.istop|default=0}"  />
        </div>
      </li>
      {/if}    
      
       <li>
        <label>图片：</label>
        <div class="item">
          <input type="text" name="img" value="{$v.img}" class="input"/>
          <button type="button" class="button fl" onclick="sycms.showupload(this)" id="image1" at="dg"><i class="icon-plus"></i>上传图片</button>
          <div class="clear"></div>
          <div class="input-image">{if $v.img}<img src="{$v.img}" alt="" />{/if}</div>
        </div>
      </li>  
      
      <li>
        <label>图片2：</label>
        <div class="item">
          <input type="text" name="img1" value="{$v.img1}" class="input"/>
          <button type="button" class="button fl" onclick="sycms.showupload(this)" id="image2" at="dg"><i class="icon-plus"></i>上传图片</button>
          <div class="clear"></div>
          <div class="input-image">{if $v.img1}<img src="{$v.img1}" alt="" />{/if}</div>
        </div>
      </li>      
      
      
      <li style="margin-bottom:15px; overflow:hidden;">
        <label>描述：</label>
        <div class="item">
          <textarea type="text" class="input w100" name="note"  style="height:80px;">{$v.note}</textarea>
        </div>
      </li>     
    </ul>        
    <ul>
      <li>
        <label>&nbsp;</label>
        <div class="item">
          <button type="submit" class="button"><i class="icon-check"></i>{$v.id?'编辑':'添加'}</button>
        </div>
      </li>
    </ul>
  </form>
</div>
</div>
<script> 
sycms.submitform("{:url('index',['nid'=>$nid])}"); 
layui.use('laydate', function(){
  var laydate = layui.laydate;
  laydate.render({
    elem: '#datetime' //指定元素
	,type: 'datetime'
	,isInitValue:false
  });
});
function _checkbox(name){
   var v = $("input[name="+name+"]").val();
       v = v==0?1:0;
   $("input[name="+name+"]").val(v);	
}
$(function(){
	$(".box-head ul li").click(function(){
		$(this).addClass("on").siblings().removeClass("on");
		$(".tabcon").hide().eq($(this).index()).show();
	})	
})
</script>